<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
  xmlns:f="livcos.org/ns/xslt/function" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:doc="livcos.org/ns/doc" 
  xmlns:c="livcos.org/ns/cosmos" 
  exclude-result-prefixes="doc f c">
  
  <xsl:import href="../../web/Intro.xsl"/>
  
  <xsl:template match="doc:link[starts-with(@ref, 'javascript:')]">
    <xsl:variable name="cntxt" select="substring-before($jobObject/c:request/url, $jobObject/c:request/access/@uri)"/>
    <a id="{@id}" href="{replace(@ref, 'http://localhost:8080/livcos', $cntxt)}">
      <xsl:apply-templates select="@note"/>
      <xsl:apply-templates select="node()"/>
      <xsl:if test="normalize-space(node()) = ''">
        <xsl:value-of select="@ref"/>
      </xsl:if>
    </a>
  </xsl:template>
  
</xsl:stylesheet>